package com.itoffer.mapper;

import com.itoffer.pojo.Applicant;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


public interface ApplicantMapper {

    /**
     * 根据用户名和密码查询用户
     * @param applicant_email
     * @param applicant_pwd
     * @return
     */
    @Select("select * from tb_applicant where applicant_email = #{applicant_email} and applicant_pwd = #{applicant_pwd}")
    Applicant select(@Param("applicant_email") String applicant_email, @Param("applicant_pwd") String applicant_pwd);


    /**
     * 根据邮箱查询用户
     * @param applicant_email
     * @return
     */
    @Select("select * from tb_applicant where applicant_email = #{applicant_email}")
    Applicant selectByApplicant_email(String applicant_email);


    /**
     * 添加用户
     * @param applicant
     */
    @Insert("insert into tb_applicant values (null,#{applicant_email},#{applicant_pwd},#{applicant_registerDate}) ")
    void addApplicant(Applicant applicant);


    /**
     * 修改用户密码
     * @param applicant_id
     * @return
     */
    @Update("update tb_applicant set applicant_pwd =#{newPwd} where applicant_id =#{applicant_id}")
    int updateApplicantPassword(@Param("newPwd") String newPwd,@Param("applicant_id") int applicant_id);
}
